package com.linwen.excise.huaweiOJ;

import java.util.Locale;
import java.util.Scanner;

/**
 * @ClassName HJ2_计算某字符出现次数
 * @Description
 * @Author lin
 * @Date 2022/2/18 上午12:30
 * @Version V1.0
 */
public class HJ2_计算某字符出现次数 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String target = in.next();

        System.out.println(sou1(str,target));
        System.out.println(sou2(str,target));
    }
    static int sou1(String str,String target){
        char[] arr = str.toLowerCase(Locale.ROOT).toCharArray();
        char c = target.toLowerCase(Locale.ROOT).charAt(0);
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]==c){
                count++;
            }
        }
        return count;
    }
    static int sou2(String str,String target){
        String s1 = str.toLowerCase(Locale.ROOT);
        String s2 = target.toLowerCase(Locale.ROOT);
        String s11 = s1.replaceAll(s2,"");
        return s1.length()-s11.length();
    }
}
